package com.tang.param_check.domain;

import java.util.Objects;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2022/1/15 20:25
 * @Desc
 * @Remarks
 */
public enum LoginTypeEnum {

    USERNAME(1, "账号密码登录"),
    PHONE_NUMBER(2, "手机号登录"),
    WECHAT_NUMBER(3, "微信号登录");

    private final Integer code;
    private final String desc;

    LoginTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static LoginTypeEnum findByCode(Integer code) {
        for (LoginTypeEnum value : LoginTypeEnum.values()) {
            if (Objects.equals(code, value.getCode())) {
                return value;
            }
        }
        return null;
    }

}
